﻿<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../../../assets/docs.css" rel="stylesheet" type="text/css" media="screen" />
<title>MooTools Documentation - Utilities/DOMReady</title>
</head>

<body>
  <div id="docs" class="doc">
    <div class="methods">
      <h4 class="menu-item"><a href="#"></a></h4>
    </div>
    <div class="l-border r-border span-15 content">
				<h1><a href="#">Window Event: domready</a></h1>

<p class="description">Contains the window <a href="../Element/Element.Event.html">Event</a> 'domready', which executes when the DOM is loaded.</p>

<p>To ensure that DOM elements exist when the code attempts to access them is executed, they need to be placed within the 'domready' event.</p>

<h3>Example:</h3>

<pre class="javascript">window.<span class="me1">addEvent</span><span class="br0">(</span><span class="st0">'domready'</span>, <span class="kw2">function</span><span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span>
    <span class="kw3">alert</span><span class="br0">(</span><span class="st0">'The DOM is ready!'</span><span class="br0">)</span>;
<span class="br0">}</span><span class="br0">)</span>;
</pre>

<h3>Notes:</h3>

<ul>
<li>This event is only available to the window element.</li>
<li>In some versions of Internet Explorer (ie. IE6) a script tag might be executed twice if the content-type meta-tag declaration is put after a script tag. The content-type should always be declared before any script tags.</li>
</ul>
<h3>See Also:</h3>

<p><a href="../Element/Element.Event.html">Element.Event</a></p>
    </div>
  </div>
<script type="text/javascript" src="../../../assets/mootools-core-1.3.js"></script>
<script type="text/javascript" src="../../../assets/mootools-more-smoothscroll.js"></script>
<script type="text/javascript" src="../../../assets/doc-assist.js"></script>
</body>
</html>
